#include <stdio.h>
#include <stdlib.h>
#include <string.h>

/**
 * Note: The returned array must be malloced, assume caller calls free().
 */
int* twoSum(int* nums, int numsSize, int target) {
    int i,j;
    int *ret = (int *)malloc(sizeof(int) * 3);
    memset(ret, 0, 3);
    
    for(i=0, j=0; i<numsSize; i++)
    {
        for(j=i+1; j<numsSize; j++)
        {
//            if(nums[i] > target)
//            {
//                continue;
//            }
            if((nums[i] + nums[j]) == target)
            {
                ret[0] = i;
                ret[1] = j;
                return ret;
            }
        }
    }
    return ret;
}

int main(int argc, char **argv)
{
    int nums[6] = {-1, -2, -3, -4, -5};
    int numsSize = 5;
    int target = -8;
    
    int *p = twoSum(nums, numsSize, target);    
        
    printf("p[0]:%d\n", p[0]);
    printf("p[1]:%d", p[1]);
    free(p);
    
	printf("\nhello world\n");
	return 0;
}
